<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let arr = [12, 432, 465]
        let arr1 = arr.splice(1, 2, "nihao", "wf")
        console.log(arr1)
        let arr2 = arr.slice(2, 4)
        console.log(arr2)
        let arr7 = [12, 21, 33, 44, 52]
        let a1 = arr7.reduce((previousValue, currentValue, index, array) => {
            return previousValue + currentValue
        })
        console.log(a1)
        let arr8 = ["你好", "欢迎", "进入", "界面"]
        let a2 = arr8.reduce((previousValue, currentValue) => {
            return previousValue + currentValue
        })
        console.log(a2)
        let result1 = arr7.reduce((previousValue, currentValue) => {
            return previousValue + currentValue
        }, 0)
        console.log(result1)
        for (let i = 0; i < arr7.length; i++) {
            console.log(arr7[i])
        }
        for (item of arr7) {
            console.log("item:" +
                item)
        }
        for (index in arr7) {
            console.log("下标" + index)
        }
        for (index in arr7) {
            console.log(arr7[index]) //遍历对象属性
        }
        let n = 0
        while (n < arr7.length) {
            console.log(arr7[n])
            n++
        }
    </script>
</body>

</html>